The Absolute Beginners Guide To Amos ------------------------------------- Chapter Twenty Four ---------------------- We shall now take a look at a few more commands concerning colour. The COLOUR command seems a bit daunting at first, but like most of the Amos command set it soon becomes fairly straightforward if you spend a little time studying it. When you first load Amos the screen COLOURs are set to default. If you press escape you will see the infamous yukky brown we all love to hate. Wouldn't it be nice if we could change them default colours without resorting to loading a picture or bob bank! As you can guess it's all possible in good old Amos. The default screen is a sixteen colour screen. The COLOUR numbers run from 0 to 15. These 16 numbers are commonly known as colour indexes. The first colour index (0) is black and the second COLOUR index (1) is the horrid brown. If were to enter the following line we could change that brown to blue: COLOUR 1,$00F ----| | | | | Colour index | | | RGB values The 1 is easy, it's the COLOUR index (or number if you wish) If we wanted to change the black (COLOUR 0) we would of put 0 instead of 1. I am going to have explain the second part. The $00F part is commonly known as an RGB value. You may have come across this in a Paint package such as Dpaint 3. RGB stands for Red, Green and Blue. You have to assign a value to each of these primary colours which Amos will then mix for you into a COLOUR. The range of the values are in a format called Hexadecimal. I am not going to explain the ins and outs of hex here I will just give you a simple chart: HEX DIGIT 1 2 3 4 5 6 7 8 9 A B C D E F DECIMAL 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 So from the chart you can see that the maximum value you can use is F (15) which is the brightest available of the primary colour it is assigned to. We assigned $F to B (blue) and 0 to R and 0 to G that works out as : NO RED NO GREEN MAXIMUM BLUE Example24.Amos is a palette requestor routine written by a clever chap called Rob Farnsworth. I have included it here as it allows you to see the RGB values of colours and anyway it's a superbly written program. Load it now! As seen in Rob's routine you can use the HEX$ instruction to read the COLOUR assignment of any index: PRINT HEX$(COLOUR(1)) Would now return our blue (00F) So if we wanted to put back that horrid brown, which incidentally is $A40, all we have to do is: COLOUR 1,$A40 and we are back to normal. Now we move on to the PALETTE instruction which is really just a more powerful version of COLOUR. PALETTE allows you to set as many COLOUR commands as you want in one statement. Very handy if you want to change a lot of colours in one go: PALETTE $FFF,$00F Would change COLOURs zero and one. PALETTE is quite flexible, you can insert a comma (,) to skip any COLOUR you do not want to change so if for example we wanted to change COLOURs 0,1 and 6 we would do this: PALETTE $FFF,$00F,,,$0F0,,,,,,,,, | | | | | | COLOUR 0 | COLOUR 6,NOW GREEN NOW WHITE | | COLOUR 4 STAYS AS IT WAS AS DO 3 & 5 & 7 ONWARD To save confusing you I have been putting leading zeros in the RGB values. If you put $000 in your Amos listing it will be changed to just $0 for you so don't worry if this happens. Now load Example24.Amos. End of Chapter 24 ^^^^^^^^^^^^^^^^^